<template>
  <div class="tableDiv index">
    <Header></Header>
    <div class="main2">
      <p class='current-nav'>当前位置 : <router-link to='index'>首页</router-link> <i> > </i>
        <router-link to='assessed'>{{varname}}应急预案评审</router-link> <i> > </i>形式评审
      </p>
      <div class="infor search">
        <div class="form-container clearfix">
          <div class="left-box">
            <p v-if="tit.length > 0" style="color:#4080ff;line-height:680px;text-align:center;font-size:14px;">{{tit}}</p> 
            <iframe v-else :src="leftImg"
                    frameborder="0"
                    scrolling="no"
                    width="100%"
                    height="100%"></iframe>
          </div>
          <div class="right-box">
             <router-view/>
          </div>
        </div>
      </div>
    </div>
    <Footer />
  </div>
</template>
<script>
import Header from '../common/header2'
import Footer from '../common/footer'
import config from '../../config.js'
export default {
  components: {
    Header,
    Footer
  },
  data () {
    return {
      leftImg:'',
      tit:'',
      name:'',
      varname:'',
     
    };
  },
  mounted(){
    this.getLeftUrl()
    this.varname = localStorage.planname.split('.')[0]
  },
  methods:{
       goPath(path){
      this.saveData(0,path)
    },
     lookstatus(item){
          let  baseUrl = item.viewUrl;
          var urlpath = baseUrl.indexOf("?") + 1;
          urlpath = baseUrl.substring(urlpath);
          var arrapi = urlpath.split("&");
          let  uesrMessage = {}
          arrapi.forEach(
              (item)=>{
                  var brrapi = [];
                  brrapi = item.split("=");
                  uesrMessage[brrapi[0]] = brrapi[1];
              }
          )

          let id = uesrMessage.srcFid;
          let  expires = Date.parse(new Date());
          let a = "FastDFS1234Bossien"+id +expires
          console.log(a);
          let token = this.$md5(a)
          token = token.toUpperCase()
          let that = this;
          $.ajax({
              url:config.baseUrl3+"queryPublishFileInfo.do?appId=001&srcFid="+id+"&expires="+expires+"&token="+token,
              type:'GET', //GET
              async:false,    //或false,是否异步
              data:{
              },
              timeout:5000,    //超时时间
              success:function(data,textStatus,jqXHR){
                let status = JSON.parse(data);
                if(!status.success){
                 that.tit = '文件正在转码中...'
                }
                if(status.dataObj.srcFileStatusName=="12"){
                    that.leftImg = item.viewUrl
                    localStorage.leftImg = item.viewUrl
                }else{
                  that.tit = '文件正在转码中...'
                }
              },
              error:function(xhr,textStatus){
              },
              complete:function(){
              }
          })
      },
     getLeftUrl(){
      this.postData(1)
          .then(res => {
            if (res.data.meta.success) {
             this.lookstatus(res.data.data)
            } else {
              this.$message.warning(res.data.meta.message)
            }
          })
          .catch(response => {
            console.log(response);
          });
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang='less'>
@import "../../../static/css/information.less";
.tableDiv {
  .search {
    .form-container {
      .right-box{
        .el-table{
          border-color:#ddd;
          td{
          color: #000;
          padding: 6px 0;
          p{
            margin:10px 0;
          }
        }
        th{
          text-align: center;
          padding: 0;
        }
        }
       
      }
      padding: 0 0 70px;
      margin: 0 auto;
      .bts-group {
        width: 510px;
        margin: 0 auto 30px;
        .el-button {
          width: 120px;
          color: #3f80fe;
          border-radius: 8px;
          border: 1px solid #3f80fe;
        }
        .sure {
          color: #fff;
          background: #4080ff;
          background: linear-gradient(90deg, #6eb1ff 20%, #3372ff 80%);
        }
      }
      .bts {
        text-align: center;
        width: 100%;
        .el-button {
          float: none;
        }
        .sure {
          color: #fff;
          background: #4080ff;
          background: linear-gradient(90deg, #6eb1ff 20%, #3372ff 80%);
        }
      }
    }
  }
}
</style>